
#ifndef GUI_ASSETS_H__
#define GUI_ASSETS_H__

#include <stdint.h> 
#include <string.h> 

#include "xgui_config.h"
#include "gui_hook.h"

//#define PIC_LIB_START_ADDR          (0xA00000)
//#define PIC_LIB_END_ADDR            (0x9FFFFF)

#define PIC_LIB_INFO_SIZE           (12)


typedef struct{
    uint8_t no;
    uint8_t type;
    uint8_t count;
    uint8_t bitcount;

    uint16_t w;
    uint16_t h;
    uint32_t address; 
}gui_assets_image_t;

//typedef struct{
//    uint8_t no;
//    uint8_t idx;
//    uint16_t x;
//    uint16_t y;
//}gui_assets_image_info_t; 


int gui_assets_get_image(uint32_t index, uint16_t no, gui_assets_image_t * image); 

static inline void  gui_assets_get_image_offset( gui_assets_image_t *image, int offset);




GUI_RAM_CODE
static inline void gui_assets_get_image_offset( gui_assets_image_t *image, int offset)
{
    image->address = image->address + offset * image->h * GUI_GET_PITCH(image->w) ;    
}


#if GUI_IS_SUPPORT_XIP > 0 
GUI_RAM_CODE
static void gui_assets_get_image_raw_value( uint32_t address, uint16_t *data, uint16_t size )
{
//    m_gui_hook.flash_load( address + GUI_PIC_RES_START_ADDRESS, (uint8_t*)data, size ); 
    memcpy( (uint8_t*)data, (uint8_t*)(address + GUI_PIC_RES_START_ADDRESS), size); 
    
}
#else
void gui_assets_get_image_raw_value( uint32_t offset, uint16_t *data, uint16_t size ); 
#endif 

#define GET_IMAGE_ADDR(x)       (uint8_t*)(x + GUI_PIC_RES_START_ADDRESS) 

#define GET_IMG_ADDR(x)         (x + GUI_PIC_RES_START_ADDRESS) 


const char* gui_assets_get_hour_items(int i ); 
const char* gui_assets_get_minute_items(int i ); 

const char* gui_assets_get_digital(int i ); 

#endif 

